package com.gitee.wsl.common.ui.ext.brush

import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color


/**
 * Mix a list of colors radially
 * @param inner the inner color
 * @param outer the outer color
 * @param reversed reverse the gradient
 * @return a new [Brush] for use in composables
 */
fun Brush.Companion.radial(inner: Color, outer: Color, reversed: Boolean = false): Brush {
    return if (reversed) {
        Brush.radialGradient(listOf(outer, inner))
    } else {
        Brush.radialGradient(listOf(inner, outer))
    }
}

/**
 * Mix a list of colors radially
 * @param colors list of colors
 * @param reversed reverse the gradient
 * @return a new [Brush] for use in composables
 */
fun Brush.Companion.radial(colors: List<Color>, reversed: Boolean = false): Brush {
    return if (reversed) {
        Brush.radialGradient(colors.reversed())
    } else {
        Brush.radialGradient(colors)
    }
}